module.exports = function($scope, $state, $stateParams,$resource,$modal,toaster){  
	/* 分页
        * ========================================= */
    $scope.maxSize = 5;             //最多显示多少个按钮
    $scope.bigCurrentPage = 1;      //当前页码
    $scope.itemsPerPage = 10         //每页显示几条
    $scope.searchform = {};
    $scope.getlist = function () {
        var para = {
            pageNo:$scope.bigCurrentPage, 
            pageSize:$scope.itemsPerPage,
            'state':'4'
        };
        para = angular.extend($scope.searchform, para);
        $resource('/api/as/ggc/touristFundsCapitalApplyAd/findCityTwoCapitalApplyList', {}, {}).
        save(para,function(res) {
            console.log(para);
            if (res.errcode !== 0) {
                toaster.error({title:"",body:res.errmsg});
                return;
            }
            console.log(para);
            console.log(res);
            $scope.objs = res.data.results;
            $scope.bigTotalItems = res.data.totalRecord;
        })
    };
     
    $scope.getlist();

    $scope.detail = function(item) {
        $scope.item = item;
        $scope.flag = 'info';
        var modalInstance = $modal.open({
          template: require('../views/addCapitalRule.html'),
          controller: 'addCapitalRule',
          size: 'lg',
          resolve: {
            item: function () {
                return $scope.item;
            },
            flag: function () {
              return $scope.flag;
            },
          }
        });
        modalInstance.result.then(function (showResult) {	
            $scope.getlist();
        });
    };
    
    // 申报资金
    $scope.apply = function(item) {
        $scope.flag = 'apply';
        var modalInstance = $modal.open({
        template: require('../views/declareFund.html'),
        controller: 'declareFund',
        size: 'lg',
        resolve: {
            item: function () {
                return item;
            },
            flag: function () {
                return $scope.flag;
            },
         }
        });
        modalInstance.result.then(function (showResult) {	
            $scope.getlist();
        });
    };


     //项目信息
    //   $scope.applyinfo = function(item){
    //       $scope.item=item;
    //       var modalInstance = $modal.open({
    //           template: require('../views/countryMoneyAuditInfo.html'),
    //           controller: 'countryMoneyAuditInfo',
    //           size: 'lg',
    //           resolve: {
    //               item: function () {
    //                   return  $scope.item;
    //               }  
    //           }
    //       });
    //     modalInstance.result.then(function (showResult) {	
    //                  $scope.getlist();
    //                 });
    //     }
      //企业信息
      $scope.base = function(item){
          $scope.item=item;
          $scope.flag='7'
          var modalInstance = $modal.open({
              template: require('../views/countryMoneyBase.html'),
              controller: 'countryMoneyBase',
              size: 'lg',
              resolve: {
                  item: function () {
                      return $scope.item;
                  },
                  flag:function(){
                      return $scope.flag;
                  }
              }
          });
        modalInstance.result.then(function (showResult) {	
                     $scope.getlist();
                    });
        }
      //市委终审审核通过
      $scope.yes = function(apply_id){
          console.log(apply_id);
          var modalInstance = $modal.open({
              template: require('../views/cityTwoMoneyAuditInfo.html'),
              controller: 'cityTwoMoneyAuditInfo',
              size: 'xs',
              resolve: {
                  apply_id: function () {
                      return apply_id;
                  }
              }
          });
        modalInstance.result.then(function (showResult) {	
                     $scope.getlist();
                  });
        }
      //市委终审审核驳回
      $scope.no = function(apply_id){
          console.log(apply_id);
          var modalInstance = $modal.open({
              template: require('../views/cityTwoMoneyAuditInfoNo.html'),
              controller: 'cityTwoMoneyAuditInfoNo',
              size: 'xs',
              resolve: {
                  apply_id: function () {
                      return apply_id;
                  }
              }
          });
        modalInstance.result.then(function (showResult) {	
                     $scope.getlist();
                    });
        }

    
    

 

};